package first.demo;
import java.util.Scanner;
public class axb {
    public static void main(String[] args) {
        Rcctanggle r = new Rcctanggle(1.0,0.0);
        r.change_values();
        r.premeter();
        r.area();
    }
}
class Rcctanggle{
    private double length, width;
    public Rcctanggle(double len, double wid){
        this.length = len;
        this.width = wid;
    }
    public double fd_length(){
        return length;
    }
    public double fd_width(){
        return width;
    }
    public void change_values(){
        Scanner input = new Scanner(System.in);
        while(true) {
            System.out.print("order=1,则修改length,order=0,则修改width,order=-1,则退出修改\n请输入order:");
            int order = input.nextInt();
            if (order==-1)
                break;
            System.out.print("请输入你修改的值:");
            if (order == 1)
                length = input.nextFloat();
            if (order == 0)
                width = input.nextFloat();
        }
    }//改变length或者width的值
    public void premeter(){
        System.out.println("此长方形的周长:"+((length + width) * 2));
    }
    public void area(){
        System.out.println("此长方形的面积:"+(length * width));
    }

}

